// File: projectfile.h
//
// Author(s): Dana Burkart
//
// Description: Defines the ProjectFile class, which manages loading and 
//              saving .itp files.
//

#ifndef __PROJECT_FILE_H__
#define __PROJECT_FILE_H__

#include <string.h>
#include <iostream>
#include <fstream>
#include <vector>

#include "common.h"

using namespace std;

/**
 * Iterate Project filepath.
 *
 * NOTE: sometime before v0.1 we need to fix the itp file-type to be more
 *   dynamic. This will save shit-tons of space.... Right now we can't have
 *   pathnames more than 128 bytes long, and they are ALWAYS 128 bytes long.
 *   since pathnames are local, we should never really nead 128 bytes of 
 *   storage.
 */
struct ITPFile {
    char path[128];
};

/**
 * This class manages saving and loading Iterate Project files.
 */
class ProjectFile {
    public:
        ProjectFile();
        ProjectFile(const char *);
        ~ProjectFile() {}

		void load(void);
        void load(char *);
        void save();
        
        void addMetaItem(const ITPMeta *metaItem);
        void addFile(const char *);
        
        const char *name(void) const;
        const char *name(const char *projectName);
        
        const char *fileVersion(void) const;
        int fileCount(void) const;
        vector<ITPMeta> metaItems(void) const;
        vector<ITPFile> files(void) const;
        
        void print(void) const;
        
    protected:
        void save(char *filename);
        
    private:
        ITPHeader _header;
        vector<ITPMeta> _metaItems;
        vector<ITPFile> _files;
};

#endif

